package host

import "sync"

type HypervisorType struct {
	TypeName string
	Exposed  bool
}

var (
	_lockHypervisorType = sync.RWMutex{}
	types               = map[string]*HypervisorType{}
)

func HasType(typeName string) bool {
	_lockHypervisorType.RLock()
	_, ok := types[typeName]
	_lockHypervisorType.RUnlock()
	return ok
}

func NewHypervisorType(typeName string, exposed bool) *HypervisorType {
	t := &HypervisorType{
		TypeName: typeName,
		Exposed:  exposed,
	}

	_lockHypervisorType.Lock()
	types[t.TypeName] = t
	_lockHypervisorType.Unlock()

	return t
}
